<?php
include_once("./config/DB.php");

class User
{
	private $userName;
	private $password;
	private $type;  //0 represents User,1 represents renter,BOOLEAN
	private $balance;//balance of the user ,FLOAT
	private $WechatCode;// a series of codes in random, CHARS
	public function __construct($wechat)
	{
		//echo $user;
		//echo $wechat;
		$db= new DB();
		$db->getDB("sql_flyingwings");
		$this->WechatCode=$wechat;
		$result= $db->select("User",'*',"wechatcode='".$wechat."'")[0];//for example
		
		$this->userName=$result['user_id'];
		$this->password=$result['password'];
		$this->type=$result['type'];
		$this->balance=$result['balance'];
		//$this->WechatCode=$result['wechatcode'];
		//echo $this->password;
		//echo $this->balance;
		//	echo $this->userName."<br/>";
		//	echo $this->type;
	}
	public function getUser()
	{
		return $this->userName;
	}
	public function getPass()
	{
		return $this->password;
	}
	public function getType()
	{
		return $this->type;
	}
	public function getBalance()
	{
		return $this->balance;
	}
	
}
/*
$a=new User("o12Ils0_VYcq3339QybKPfNs2Gvs");
echo $a->getUser();
echo $a->getPass();*/